#include "JScriptEditor.h"
#include "JScriptEdit.h"
#include "JScriptHighlighter.h"

#include <QTextDocument>
#include "Qsci/qsciscintilla.h"
#include "Qsci/qscilexer.h"
#include "Qsci/qscilexerpython.h"

JScriptEditor::JScriptEditor(QWidget *parent)
	: QMainWindow(parent)
{
	ui.setupUi(this);
	QsciScintilla* textEdit = new QsciScintilla;
	QsciLexerPython *lex = new QsciLexerPython(textEdit);
	//lex->setIndentationWarning(QsciLexerPython::IndentationWarning::Inconsistent);

	textEdit->setLexer(lex);
	textEdit->setMarginLineNumbers(1, true);
	textEdit->setMarginWidth(1,"1000");
	QFont font;
	font.setFamily(QString::fromUtf8("Courier New"));
	font.setPointSize(8);
	textEdit->setMarginsFont(font);
	textEdit->setFont(font);
	textEdit->setBraceMatching(textEdit->SloppyBraceMatch);
	textEdit->setFolding(QsciScintilla::BoxedTreeFoldStyle);
	textEdit->setAutoIndent(true);
	//JScriptHighlighter* highlighter = new JScriptHighlighter((QTextDocument)textEdit->document());
	setCentralWidget(textEdit);

	/*JScriptEdit *pythonEdit = new JScriptEdit(ui.centralWidget);
	ui.gridLayout->addWidget(pythonEdit,0,2);
	LineNumberPanel *mLineNumPanel = new LineNumberPanel(ui.centralWidget);
	mLineNumPanel->attach(pythonEdit);
	ui.gridLayout->addWidget(mLineNumPanel,0,0);
	LineFoldPanel *mFoldPanel = new LineFoldPanel(ui.centralWidget);
	ui.gridLayout->addWidget(mFoldPanel,0,1);
	mFoldPanel->attach(pythonEdit);*/

	//NumberedTextView *abcd = new NumberedTextView(ui.centralWidget);
	//ui.gridLayout->addWidget(abcd);
}

JScriptEditor::~JScriptEditor()
{

}
